package test1_1;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

public class CommissionTest {

    private CommissionCalculator calculator;

    @Before
    public void setUp() {
        calculator = new CommissionCalculator();
    }

    @Test
    public void testCommission_ZeroSales() {
        assertEquals(-1, calculator.commission(0, 0, 0), 0.001);
    }

    @Test
    public void testCommission_ZeroheadphonesSales() {
        assertEquals(112, calculator.commission(0, 100, 10), 0.001);//100*10+10*8=1080
    }

    @Test
    public void testCommission_Boundary1000() {
        assertEquals(214, calculator.commission(12, 80, 0), 0.001); // 12*80 + 80*10 = 1760
    }

    @Test
    public void testCommission_Boundary1800() {
        assertEquals(252, calculator.commission(12, 80, 25), 0.001); // 12*80 + 80*10 + 25*8 = 1960
    }

    @Test
    public void testCommission_Over1800() {
        assertEquals(260, calculator.commission(20, 0, 50), 0.001); // 20*80 + 50*8 = 2000
    }

    @Test
    public void testCommission_LessThan1000() {
        assertEquals(8, calculator.commission(1, 0, 0), 0.001); // 1*80 = 80
    }

    @Test
    public void testCommission_Between1000And1800() {
        assertEquals(160, calculator.commission(15, 20, 0), 0.001); // 15*80 + 20*10 = 1400
    }

    @Test
    public void testCommission_GreaterThan1800() {
        assertEquals(360, calculator.commission(20, 50, 50), 0.001); // 20*80 + 50*10 + 50*8 = 2500
    }

    @Test
    public void testCommission_NegativeInput() {
        assertEquals(-1, calculator.commission(-1, 0, 0), 0.001);
        assertEquals(-1, calculator.commission(0, -1, 0), 0.001);
        assertEquals(-1, calculator.commission(0, 0, -1), 0.001);
    }
}
